<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script src='./vue.global.js'></script>
    <link rel="stylesheet" href="./node_modules/font-awesome/css/font-awesome.css">
</head>

<body>
    <div id='app'>
        <todo-button>
            <!-- 添加一个 Font Awesome 图标 -->
            <i class="fas fa-address-book"></i>
            Add todo
        </todo-button>
        <hr>

        <todo-button>
            <!-- 添加一个图标的组件 -->
            <font-awesome-icon name="plus"></font-awesome-icon>
            Add todo
        </todo-button>
        <hr>

        <todo-button>
            Delete a {{ item.name }}
        </todo-button>
        <hr>

        <submit-button></submit-button>
        <submit-button>Save</submit-button>

    </div>

    <script>
        const app = Vue.createApp({
            data() {
                return {
                    count: 0,
                    item: {
                        name: "乌拉"
                    }
                }
            }
        })

        app.component(
            "todo-button",
            {
                template: `
                <!-- todo-button 组件模板 -->
                <button class="btn-primary">
                    <slot></slot>
                </button>
                `

            }
        )

        app.component(
            "submit-button",
            {
                template: `
                <!-- todo-button 组件模板 -->
                <button class="btn-primary">
                    <slot>Submit</slot>
                </button>
                `,
            }
        )

        const vm = app.mount('#app')
    </script>
</body>

</html>